//
//  JrdAccountViewController.m
//  v2ex-iOS
//
//  Created by longcheng on 16/5/24.
//  Copyright © 2016年 Singro. All rights reserved.
//

#import "JrdAccountViewController.h"
#import "JrdCommon.h"
#import "UIColor+JRDNote.h"
#define TABLE_CELL_HEIGHT_ACCOUNT (45)
@interface JrdAccountViewController ()<UITableViewDataSource, UITableViewDelegate>
@property(nonatomic,strong)UITableView* tableView;
@property (nonatomic, strong) SCBarButtonItem *leftBarItem;
@end

@implementation JrdAccountViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.sc_navigationItem.leftBarButtonItem = self.leftBarItem;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)loadView{
    [self configureTableView];
    [self configureNavibarItems];
}

- (void)configureTableView{
    self.tableView                 = [[UITableView alloc] initWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT - (NAVIGATION_BAR_HEIGHT))];
    self.tableView.separatorStyle  = UITableViewCellSeparatorStyleNone;
    self.tableView.delegate        = self;
    self.tableView.dataSource      = self;
    self.tableView.scrollEnabled  = NO;
    self.tableView.backgroundColor = JRD_RGB(240, 240, 240);
    [self.view addSubview:self.tableView];
}

- (void)configureNavibarItems {
    
    self.leftBarItem = [[SCBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ico-menu"] highlight:[UIImage imageNamed:@"ico-menu"] style:SCBarButtonItemStylePlain handler:^(id sender) {
        [[NSNotificationCenter defaultCenter] postNotificationName:kShowMenuNotification object:nil];
    }];
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return TABLE_CELL_HEIGHT_ACCOUNT;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    }
    
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, (TABLE_CELL_HEIGHT_ACCOUNT - 0.5), SCREEN_WIDTH, 0.5)];
    lineView.backgroundColor = [UIColor blackColor];//JRD_RGB(200, 199, 204);
    [cell addSubview:lineView];
    
    
    UIFont *myFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:17.0];
    cell.textLabel.font = myFont;
    [cell.textLabel setTextColor:[UIColor JRDColorMainSettingCellText]];
    cell.detailTextLabel.font = myFont;
    cell.detailTextLabel.textColor = [UIColor JRDColorStandardBlue];
    cell.textLabel.text = NSLocalizedString(@"v2_Account", nil);
    cell.imageView.image = [UIImage imageNamed:@"icon_setting"];
    cell.backgroundColor = JRD_RGB(240, 240, 240);
    [cell setSelectionStyle:UITableViewCellSelectionStyleBlue];
    [cell.layer setMasksToBounds:YES];
    cell.layer.cornerRadius =5;
    return cell;
}

@end
